#pragma once
#ifndef BUFFER_HPP
#define BUFFER_HPP

#include "BufferInterface.hpp"
#include <list>
#include <memory>

namespace Buffer {

using BufferRef = std::shared_ptr<BufferBase>;

/*
  Buffer Pool include different buffers
*/
class BufferPool {
public:
  /* Get Current BufferPool instance */
  static BufferPool &GetInstance();

  /*
    Create a buffer object
    @param type buffer type
    @param format buffer format
    @return buffer pointer
  */
  BufferRef CreateABuffer(const BufferType &type);

  /* Remove a buffer object */
  void RemoveBuffer(GLuint id);

  /*
    Whether contain this buffer in this pool
    @param id buffer id
    @return if constains return true otherwise return false
  */
  bool Contains(GLuint id) const;

  /* Clear all buffer objects in current pool */
  void Clear();

  ~BufferPool();

private:
  BufferPool();

private:
  std::list<BufferBase *> buffers;
};

} // namespace Buffer

#endif